# -*- coding: utf-8 -*-
"""
Created on Tue Feb  2 15:43:46 2021

@author: rober
"""
from Spectra.NewmarkCA import newmarkCA 
from Spectra.NewmarkCD import newmarkCD 
import numpy as np

#acc in m/s2

def spectrumAD(time,acc,T):
    
    
    Sa = np.zeros(len(T))
    Sd = np.zeros(len(T))
    dta = time[1]-time[0]
    Npt = len(time)
    
    Sa[0] = max(abs(acc))/9.805
    
    for i in range(1,len(T)):

        Sa[i] = newmarkCA(T[i],0.05,acc,dta,Npt)/9.805
        Sd[i] = newmarkCD(T[i],0.05,acc,dta,Npt)
        
    return Sa,Sd
